import axios from 'axios'
import { Toast } from 'vant'
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
// 配置根路径 
// axios.defaults.baseURL = 'http://itfly.vip'
const service = axios.create({
  baseURL: 'http://itfly.vip'
})

service.interceptors.request.use(config => {
  NProgress.start()
  return config
})
// 响应拦截
service.interceptors.response.use(config => {
  NProgress.done()
  return config
}, (err) => {
  Toast('网络请求失败...')
  Promise.reject(err)
})

export default service